<!DOCTYPE html>
<html lang="pt-BR">
    <head>
        <?php
        session_start();
        include_once'bloco/head.php';
        include_once '../control/conexao.php';
        include_once '../control/valida_sessao.php';

        function __autoload($classe) {
            include_once"../model/{$classe}.class.php";
        }
        ?>
        <link href="bootstrap/css/morris.css" rel="stylesheet">
    </head>
    <body>      
        <div id="wrapper">
            <?php
            include_once'bloco/navbar.php';
            include_once '../control/valida_perfil.php';
            ?>
            <div id="page-wrapper">
                <?php include_once 'bloco/banner.php'; ?>                  
                <div class="row">
                    <div class=" panel panel-success">
                        <div class="panel-heading">
                            <p class="panel-title"><i class = "glyphicon glyphicon-th-large"></i> Editar Processo</p>
                        </div>
                        <div class="panel-body">
                            <div class="col-lg-12 ">
                                <form autocomplete="off" name="form_edita_funcionario" method="post" action="../control/editar_processo.php">
                                    <div class="row">
                                        <div class="col-md-6 col-md-offset-3">
                                            <div class="alert alert-success alert-dismissable">
                                                <table class="table table-condensed table-responsive">                                    
                                                    <?php
                                                    $processo = new processo();
                                                    $processo->id_processo = $_GET['id'];
                                                    $processoDAO = new processoDAO();
                                                    $processo = $processoDAO->consultar($processo);
                                                    ?>
                                                    <tr>
                                                        <td><strong>Matricula do Aluno</strong></td>
                                                        <td><?php echo $processo->matricula ?></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Processo N°</strong></td>
                                                        <td><?php echo $processo->id_processo ?></td>
                                                    </tr>
                                                    <?php
                                                    $consulta_status1 = mysql_query("SELECT * FROM status WHERE id_status='$processo->id_status'");
                                                    $status = mysql_result($consulta_status1, 0, 'status_nome');
                                                    $consulta_status2 = mysql_query("SELECT * FROM status ORDER BY id_status");
                                                    $ln = mysql_num_rows($consulta_status2);
                                                    ?>

                                                    <tr>
                                                        <td><strong>Status</strong></td>
                                                        <td><select name="status" class='btn'>
                                                                <option value="<?php echo $processo->id_status ?>"><?php echo utf8_encode($status) ?></option>
                                                                <?php
                                                                for ($i = 0; $i < $ln; $i++) {
                                                                    $id_status = mysql_result($consulta_status2, $i, "id_status");
                                                                    $status_nome = mysql_result($consulta_status2, $i, "status_nome");
                                                                    ?>
                                                                    <option value="<?php echo $id_status ?>"><?php echo utf8_encode($status_nome) ?></option>
                                                                <?php } ?>
                                                            </select>
                                                        </td>                                        
                                                    </tr>                                        
                                                    <tr>
                                                        <td><strong>Vaga N°</strong></td>
                                                        <td><a href="exibir_vaga.php?id_vaga=<?php echo $processo->id_vaga ?>"><?php echo $processo->id_vaga ?></a></td>
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Data de Inicio</strong></td>
                                                        <td><?php echo $processo->data_inicio ?></td>                                        
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Data de Finalização</strong></td>
                                                        <td><input tpe="text" class="btn" name="data" id="data" readonly="readonly" value="<?php echo $processo->data_fim ?>"></td>                                        
                                                    </tr>
                                                    <tr>
                                                        <td><strong>Observação</strong></td>
                                                        <td><textarea name="observacao" cols="35" rows="5"><?php echo utf8_encode($processo->observacao) ?></textarea></td>                                        
                                                    </tr>
                                                </table>
                                                <input type="hidden" name="id_processo" value="<?php echo $processo->id_processo ?>">
                                                <div align="center">
                                                    <input type="button" class="btn btn-inverse" value="Voltar" onclick="history.go(-1)"/>
                                                    <input type="submit" class="btn btn-success" value="Salvar"/>
                                                </div>
                                            </div>
                                        </div>                                       
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?php
        include_once'bloco/scripts.php';
        ?>      
        <script>
            $(function() {
                $("#data").datepicker({
                    dateFormat: 'dd-mm-yy',
                    changeMonth: true,
                    changeYear: true,
                    dayNames: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sábado', 'Domingo'],
                    dayNamesMin: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S', 'D'],
                    dayNamesShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sáb', 'Dom'],
                    monthNames: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
                    monthNamesShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez']
                });
            });
        </script>
        <link rel="stylesheet" href="bootstrap/js/data/data.css"/>
        <script src="bootstrap/js/data/jquery-1.8.2.js"></script>
        <script src="bootstrap/js/data/jquery-ui.js"></script>
    </body>
</html>